package tcp_net.mail.pop3.commands;

import tcp_net.mail.MailBoxFileManager;
import tcp_net.mail.pop3.commands.debug.DebugInfo;

import java.util.List;
import java.util.ArrayList;

/**
	This class provides a defined command to be executed
	@author J. Okuno
*/
public class TOP extends POP3Command 
{
	/**
		A message number
	*/
	private int msg;
	
	/**
		A number of lines
	*/
	private int n;
	
	/**
		Init the class
		@param m a message number
		@param lines a number of lines
		@param man a mailbox file manager
	*/
	public TOP(int m, int lines, MailBoxFileManager man) 
	{ 
		super(man);
		msg = m; 
		n = lines; 
	}
	
	/**
		This method executes a defined command
		@return a list of reply messages in a string format
	*/
	public List<String> execute() 
	{
		
		//find out the msg based on a msg no. (No -ve no. and must not be detele marked)
		
		//if found,
			//send the header of the message
			reply = new POP3ReplyMessage(true, "top of message follows");
			reply_msgs.add(reply.execute().get(0));
		
		//not foud
			reply = new POP3ReplyMessage(false, "no such message");
			reply_msgs.add(reply.execute().get(0));
		
		return reply_msgs;
	}
}